package com.yswee.framework.widget.loading;

import com.yswee.framework.R;
import com.yswee.framework.widget.RotateView;
import com.yswee.framework.widget.layoutview.MRelativeLayout;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

public class MFooterBar extends MRelativeLayout<Void> implements IFooterBar {

	protected RotateView prgLoading;
	protected TextView tvLoading;
	protected TextView tvLoadAll;
	
	public MFooterBar(Context context) {
		super(context);
	}
	
	public MFooterBar(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	public MFooterBar(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	
	@Override
	protected void initializeLayout(Context context) {
		super.initializeLayout(context);
		setFocusable(false);
		setClickable(false);
	}

	@Override
	protected int getLayoutResId() {
		return R.layout.widget_pulltorefresh_footer;
	}

	@Override
	protected void onFindView() {
		prgLoading = (RotateView) findViewById(R.id.pull_to_refresh_progress);
		tvLoading = (TextView) findViewById(R.id.pull_to_refresh_text);
		tvLoadAll = (TextView) findViewById(R.id.pull_to_refresh_loadall);
	}

	@Override
	protected void onApplyData() {
		
	}

	@Override
	public void showLoading() {
		prgLoading.setVisibility(View.VISIBLE);
		tvLoading.setVisibility(View.VISIBLE);
		tvLoadAll.setVisibility(View.GONE);
	}

	@Override
	public void showLoadAll() {
		prgLoading.setVisibility(View.GONE);
		tvLoading.setVisibility(View.GONE);
		tvLoadAll.setVisibility(View.VISIBLE);
	}

}
